package com.vhall.component.controller.room.facade;

import com.alibaba.fastjson.JSONObject;
import com.vhall.component.entity.audit.vo.AuditRecordResponseVO;
import com.vhall.component.entity.inav.vo.InavRoomGetRespVO;
import com.vhall.component.entity.room.RoomBaseInfoResponseVO;
import com.vhall.component.entity.room.dto.RoomWatermarkDTO;
import com.vhall.component.entity.room.vo.*;
import com.vhall.component.plugin.common.annotation.TokenAuth;
import com.vhall.component.plugin.common.enums.OperateTypeEnum;
import com.vhall.component.service.annotation.OperateLog;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * console端-房间管理
 *
 * @author guoxin.wang
 * @date 2021/7/12 17:30
 */
@FeignClient(value = "RoomConsoleFacade", path = "/v4/room/console")
public interface RoomConsoleFacade {

    /**
     * 创建直播
     *
     * @param reqVO 参数
     * @return 创建的对象信息
     */
    @TokenAuth
    @PostMapping(value = "/create")
    RoomRespVO create(@RequestBody @Validated CreateRoomNewVO reqVO);

    /**
     * 直播送审
     */
    @PostMapping(value = "/submit_for_approval")
    Boolean submitForApproval(@Validated SubmitForApprovalVO vo);

    /**
     * 撤销审核
     */
    @GetMapping(value = "/revoke_review")
    Boolean revokeReview(@RequestParam("il_id") Integer ilId);

    /**
     * 直播间列表
     *
     * @param reqVO 参数
     * @return RoomConsoleListRespVO
     */
    @TokenAuth
    @PostMapping(value = "/list")
    RoomConsoleListRespVO list(@Validated RoomConsoleListVO reqVO);

    /**
     * 合规检查列表
     * @param reqVO
     * @return
     */
    @TokenAuth
    @PostMapping(value = "/compliance-check-list")
    RoomConsoleListRespVO complianceCheckList(@Validated RoomConsoleListVO reqVO);

    /**
     * 回放检查（产品类回放）
     */
    @TokenAuth
    @PostMapping(value = "/playback_check")
    RoomConsoleListRespVO playbackCheck(@Validated RoomConsoleListVO reqVO);


    /**
     * 投资依据列表
     */
    @TokenAuth(check = false)
    @GetMapping(value = "/invest_ref_list")
    List<InvestRefResponseVO> investRefList(@RequestParam("il_id") Integer ilId);

    /**
     * 审核直播列表
     * 1 显示房间审核状态不为待送审的房间
     * 2 显示当前用户对应所属区域的房间
     *
     * @param reqVO 参数
     * @return RoomConsoleListRespVO
     */
    @TokenAuth
    @GetMapping(value = "/audit-room-list")
    RoomConsoleListRespVO roomAuditList(@Validated RoomAuditConsoleListVO reqVO);

    /**
     * 权限分配
     *
     * @param reqVO 参数
     * @return RoomSupplyRespVO
     */
    @GetMapping(value = "/get-competence")
    RoomSupplyRespVO getCompetence(@Validated RoomLimitsVO reqVO);

    /**
     * 获取房间状态
     *
     * @param reqVO 参数
     * @return JSONObject
     */
    @PostMapping(value = "/get-room-status")
    @TokenAuth
    JSONObject getRoomStatus(@Validated RoomLimitsVO reqVO);

    /**
     * 获取房间信息
     *
     * @param reqVO 参数
     * @return InavRoomGetRespVO
     */
    @TokenAuth
    @GetMapping(value = "/get")
    InavRoomGetRespVO getRoom(@Validated RoomLimitsVO reqVO);

    /**
     * 保存暖场视频
     *
     * @param reqVO 参数
     * @return Boolean
     */
    @TokenAuth
    @PostMapping(value = "/save-warm")
    Boolean saveWarm(@Validated WarmVO reqVO);

    /**
     * 获取房间的暖场信息
     *
     * @param reqVO 参数
     * @return WarmRespVO
     */
    @PostMapping(value = "/get-warm")
    WarmRespVO getWarmInfo(@Validated WarmReqVO reqVO);

    /**
     * 更新房间信息
     *
     * @param reqVO 参数
     * @return Boolean
     */
    @PostMapping(value = "/update")
    Boolean update(@RequestBody @Validated CreateRoomNewVO reqVO);

    /**
     * 删除房间信息
     *
     * @param reqVO 参数
     * @return List<String>
     */
    @PostMapping(value = "/delete")
    List<String> delete(@Validated DelRoomVO reqVO);

    /**
     * 获取推流地址
     *
     * @param reqVO 参数
     * @return JSONObject
     */
    @GetMapping(value = "/get-stream-address")
    JSONObject getStreamAddress(@Validated RoomLimitsVO reqVO);

    /**
     * 获取accessToken
     *
     * @param reqVO 参数
     * @return JSONObject
     */
    @PostMapping(value = "/get-access-token")
    JSONObject getAccessToken(@Validated RoomLimitsVO reqVO);

    /**
     * 在线检测
     *
     * @param reqVO 参数
     * @return Map<String, Object>
     */
    @PostMapping(value = "/online-check")
    @TokenAuth
    Map<String, Object> getOnlineCheck(@Validated OnlineCheckVO reqVO);

    /**
     * 自定义菜单
     *
     * @param reqVO 参数
     * @return JSONObject
     */
    @PostMapping(value = "/diypage/custom-tag")
    @TokenAuth
    JSONObject customTag(@Validated CustomMenuVO reqVO);

    /**
     * 更新自定义菜单
     *
     * @param reqVO 参数
     * @return JSONObject
     */
    @PostMapping(value = "/diypage/update-custom-tag")
    @TokenAuth
    JSONObject editCustomTag(@Validated CustomMenuEditVO reqVO);

    /**
     * 更新直播模式
     *
     * @param reqVO 参数
     * @return Boolean
     */
    @PostMapping(value = "/add-live-mode")
    @TokenAuth
    Boolean addLiveMode(@Validated AddLiveModeVO reqVO);


    /**
     * 单条新增流地址
     *
     * @param reqVO 参数
     * @return Boolean
     */
    @PostMapping(value = "/flow/add")
    @TokenAuth
    Boolean addPushStream(@Validated PushStreamReqVO reqVO);

    /**
     * 批量新增流地址
     *
     * @param dataList 流地址
     * @return Boolean
     */
    @PostMapping(value = "/flow/adds")
    @TokenAuth
    Boolean addPushStreamList(@RequestParam("data") String dataList);


    /**
     * 单条删除流地址
     *
     * @param id 参数
     * @return Boolean
     */
    @PostMapping(value = "/flow/delFlows")
    @TokenAuth
    Boolean delPushStreamsById(@RequestParam("id") Integer id);


    /**
     * 单条编辑流地址
     *
     * @param reqVO 参数
     * @return Boolean
     */
    @PostMapping(value = "/flow/updateFlows")
    @TokenAuth
    Boolean editPushStream(@Validated PushStreamReqVO reqVO);


    /**
     * 获取流地址详情
     *
     * @param id 参数
     * @return PushStreamSingleRspVO
     */
    @PostMapping(value = "/flow/get")
    @TokenAuth
    PushStreamSingleRspVO getPushStreamDeatil(@RequestParam("id") Integer id);


    /**
     * 获取推流列表
     *
     * @param reqVO 参数
     * @return List<PushStreamSingleRspVO>
     */
    @PostMapping(value = "/flow/list")
    @TokenAuth
    List<PushStreamSingleRspVO> getPushStreamList(PushStreamListReqVO reqVO);


    /**
     * 单条推流
     *
     * @param id 参数
     * @return Boolean
     */
    @PostMapping(value = "/flow/start")
    @TokenAuth
    Boolean pushStreamStart(@RequestParam("id") Integer id);


    /**
     * 批量推流
     *
     * @param dataList 参数
     * @return Boolean
     */
    @PostMapping(value = "/flow/batch-push")
    @TokenAuth
    Boolean pushStreamStartBatch(@RequestParam("data") String dataList);


    /**
     * 停止推流
     *
     * @param id 转推流表Id
     * @return Boolean
     */
    @PostMapping(value = "/flow/end-push")
    @TokenAuth
    Boolean pushStreamEnd(@RequestParam("id") Integer id);


    /**
     * 推流统计
     *
     * @param roomId PAAS直播房间id
     * @return PushStreamStatisticsRspVO
     */
    @PostMapping(value = "/flow/statistics")
    @TokenAuth
    PushStreamStatisticsRspVO pushStreamStatistics(@RequestParam("room_id") String roomId);

    /**
     * 房间水印配置
     *
     * @param roomWatermarkVO 参数
     * @return 是否设置成功
     */
    @TokenAuth
    @PostMapping(value = "/watermark/set")
    Boolean createWatermark(@Validated RoomWatermarkVO roomWatermarkVO);

    /**
     * 房间水印信息
     *
     * @param roomId 房间id
     * @return 房间水印信息
     */
    @TokenAuth
    @GetMapping(value = "/watermark/info")
    RoomWatermarkDTO getRoomWatermark(@RequestParam("room_id") String roomId);

    /**
     * 获取视频首帧做封面图
     */
    @PostMapping(value = "/get_first_frame_of_video")
    FirstFrameFromVideoRspVO getTheFirstFrameOfTheVideo(@Validated FirstFrameFromVideoVO reqVO);

    /**
     * 预约开关设置
     */
    @PostMapping(value = "/reservation_status")
    Boolean reservationStatusRoom(@Validated RoomOperationStatusVO vo);

    /**
     * 聊天、表情开关设置 2.0
     */
    @TokenAuth
    @PostMapping(value = "/comment_status")
    Boolean commentStatusRoom(@Validated RoomCommentStatusVO vo);

    /**
     * 保存拉流地址
     *
     * @param vo
     * @return
     */
    @PostMapping(value = "/savePullStreamUrl")
    Boolean savePullStreamUrl(@Validated RoomPullStreamVO vo);

    /**
     * 开始推流
     *
     * @param vo
     * @return
     */
    @PostMapping(value = "/startPullStream")
    Boolean startPullStream(@Validated RoomPullStreamInfoVO vo);

    /**
     * 结束推流
     *
     * @param vo
     * @return
     */
    @PostMapping(value = "/endPullStream")
    Boolean endPullStream(@Validated RoomPullStreamInfoVO vo);

    /**
     * 获取推流信息
     *
     * @param vo
     * @return
     */
    @TokenAuth
    @PostMapping(value = "/getPullStreamStatus")
    RoomPullStreamRespVO getPullStreamStatus(@Validated RoomPullStreamInfoVO vo);

    /**
     * 获取房间基本信息结构
     *
     * @return vo
     */
    @GetMapping(value = "/create-room-base")
    RoomBaseInfoResponseVO getRoomBaseInfo();

    /**
     * 获取直播价格列表
     *
     * @return
     */
    @GetMapping(value = "/live-price-list")
    List<LivePriceResponseVO> getLivePriceList();

    /**
     * 房间审核
     *
     * @param vo
     * @return
     */
    @TokenAuth
    @OperateLog(module = "房间审核列表", type = OperateTypeEnum.UPDATE, name = "房间审核")
    @PostMapping(value = "/audit-room")
    Boolean auditRoom(@Validated RoomAuditRequestVO vo);

    /**
     * 房间审核记录list
     *
     * @param vo
     * @return
     */
    @TokenAuth
    @GetMapping(value = "/room-audit-record/list")
    List<AuditRecordResponseVO> roomAuditRecordList(@Validated RoomAuditRecordRequestVO vo);

    /**
     * 业务检查
     *
     * @param vo
     * @return
     */
    @PostMapping(value = "/inspection-room")
    Boolean inspectionRoom(@Validated RoomInspectionReqVO vo);

    /**
     * 二维码列表
     */
    @GetMapping(value = "/qr_code_list")
    List<RoomQrCodeListRspVO> qrCodeList(@RequestParam("room_id") String roomId);

    /**
     * 生成-二维码
     */
    @PostMapping(value = "/gen_qr_code")
    Boolean genQrCode(@Validated RoomQrCodeListReqVO vo);

    /**
     * 删除-二维码
     */
    @GetMapping(value = "/del_qr_code")
    Boolean delQrCode(@RequestParam("id") Integer id);


    /**
     * console端通过后台直播列表结束直播
     *
     * @param vo
     * @return
     */
    @TokenAuth
    @PostMapping("/end-live")
    Boolean consoleEndLive(@Validated ConsoleEndLiveRequestVO vo);

    /**
     * 合规检查
     * @param ilId
     * @param auditStatus  -1 不通过 0 待审核  1 通过
     * @param desc
     * @return
     */
    @PostMapping("/compliance-check")
    Boolean complianceCheck(@RequestParam("il_id") Integer ilId,
                            @RequestParam("audit_status") Integer auditStatus,
                            @RequestParam(name = "desc", required = false) String desc);

    @GetMapping("/virtual-pv")
    Long getVirtualPV(@RequestParam("il_id") Integer ilId);
    /**
     * 可见客户文件上传
     */
    @TokenAuth
    @PostMapping("/limit-scope/white-list/upload")
    LimitScopeWhiteListUploadResponseVO limitScopeWhiteListUpload(@Validated LimitScopeWhiteListUploadRequestVO vo);

    /**
     * 标记房间无需设置回放
     */
    @TokenAuth
    @PostMapping("/save-live-no-need-playback")
    LiveNotNeedPlayBackResponseVO saveLiveNotNeedPlayBack(SaveLiveNotNeedPlayBackRequestVO vo);
    /**
     * 获取房间的设置回放状态
     */
    @TokenAuth
    @GetMapping("/get-live-no-need-playback")
    LiveNotNeedPlayBackResponseVO getLiveNotNeedPlayBack(RoomsBaseRequestVO vo);
}
